<template>
  <DecorativeCard
    size="lg"
    card-style="default"
    :show-decorations="true"
    class="profile-card"
  >
    <template #header>
      <div class="profile-header">
        <div class="header-background"></div>
        <div class="avatar-wrapper">
          <img src="http://img.linzhongyue.cn/48d770d6824e43a2abf373142eba60d4.jpg" alt="Avatar" class="avatar"/>
          <div class="avatar-border"></div>
        </div>
      </div>
    </template>

    <div class="profile-content">
      <div class="profile-info">
        <h3 class="nickname">林中月</h3>
        <p class="bio">风叶落去留声，花开云舒无痕。</p>
        <div class="social-links">
          <a target="_blank" :href="blogInfo?.webSite?.github" class="social-link" title="GitHub">
            <i class="icon-github-fill"></i>
          </a>
          <a target="_blank" :href="blogInfo?.webSite?.gitee" class="social-link" title="Gitee">
            <i class="icon-gitee"></i>
          </a>
        </div>
      </div>
    </div>
  </DecorativeCard>
</template>

<script setup lang="ts">
import {onBeforeMount, toRefs} from "vue";
import DecorativeCard from './common/DecorativeCard.vue';

const props = defineProps(['blogInfo']);
const {blogInfo} = toRefs(props)

onBeforeMount(() => {
  console.log(blogInfo?.value)
})
</script>

<style lang="scss" scoped>
@import '@/assets/styles/variables.scss';
@import '@/assets/styles/mixins.scss';

.profile-card {
  overflow: hidden;
  text-align: center;
}

.profile-header {
  position: relative;
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  @include gradient-primary;
  @include center-flex;
  flex-direction: column;
  margin: calc(-1 * var(--space-xl)) calc(-1 * var(--space-xl)) 0;
  margin-bottom: var(--space-lg);
  height: 220px;
}

.header-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('../assets/img/articleList.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.3;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.avatar-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  z-index: 2;
  margin-top: auto;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  z-index: 1;
  transition: var(--transition-normal);
  border: 4px solid rgba(255, 255, 255, 0.9);

  &:hover {
    transform: scale(1.1);
  }
}

.avatar-border {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 50%;
  @include gradient-primary;
  opacity: 0.8;
  z-index: 0;
  animation: rotate 3s linear infinite;
}

.profile-content {
  position: relative;
  z-index: 2;
  padding: 0;
}

.profile-info {
  text-align: center;
  @include center-flex;
  flex-direction: column;
  gap: var(--space-md);
}

.nickname {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  margin: 0;
  @include gradient-text(linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1));
  background-size: 200% 200%;
  animation: gradient-flow 3s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

.bio {
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
  margin: 0;
  position: relative;
  z-index: 2;
  font-style: italic;
  font-size: 16px;
  line-height: var(--line-height-relaxed);
}

.social-links {
  @include center-flex;
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

.social-link {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  @include center-flex;
  color: #fff;
  transition: var(--transition-normal);
  text-decoration: none;
  font-size: var(--font-size-md);

  &:nth-child(1) {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
  }

  &:nth-child(2) {
    background: linear-gradient(45deg, #4ecdc4, #00a085);
  }

  &:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
  }

  i {
    font-size: var(--font-size-lg);
  }
}

// 动画
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes gradient-flow {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

// 暗黑模式适配
[data-theme="dark"] {
  .bio {
    color: var(--text-secondary);
  }
}

// 响应式设计
@include respond-below(md) {
  .profile-header {
    height: 180px;
    padding: var(--space-lg);
  }

  .avatar-wrapper {
    width: 100px;
    height: 100px;
  }

  .nickname {
    font-size: var(--font-size-2xl);
  }

  .bio {
    font-size: var(--font-size-md);
  }

  .social-links {
    gap: var(--space-sm);
  }

  .social-link {
    width: 36px;
    height: 36px;

    i {
      font-size: var(--font-size-md);
    }
  }
}
</style>
